<?php
/**
 * Created by PhpStorm.
 * User: dell
 * Date: 2019/1/24
 * Time: 8:52
 */
require_once "../config/config.php";
require_once "../model/adminDb.php";
$adminDb=new adminDb();
$auther=$_POST['auther'];
$page = $_POST['page'];//当前页
$limit = $_POST['limit'];//限制查询数据的数量
$firstNum = ($page - 1) * $limit;
$lastNum = $page * $limit;

$data=$adminDb->query_auther($auther);
$dataPage=$adminDb->query_auther_page($auther,$firstNum,$lastNum);

$count=count($data);
try {
    $result = $data;

    if ($result) {
        $dat = array(
            'code' => 0,
            'data'=>$dataPage,
            'count' => $count,
            'msg' => "查询成功",
        );
        echo json_encode($dat);
    } else {
        $dat = array(
            'code' => 404,
            'count' => 0,
            'msg' => "查询失败",
        );
        echo json_encode($dat);
    }
} catch (Exception $e) {
    echo $e->getMessage();
}

